<template>
	<view class="zuzhipage" >
		
		
		
		<view class="zuzhi_news_list" v-if="ZuzhiLits.length">
			<view @tap="todetaile(item.id)" class="zuzhi_news_item jus-b flex ali-c"  v-for="(item,index) in ZuzhiLits" :key="index">
				<view class="zuzhi_news_item_left  flexv flex">
					<view class="zuzhititle twoline">{{item.title}}</view>
					<view class="new_author_info flex ali-c">
						<image class="author_txing" :src="photo_cdn+item.photo" mode=""></image>
						<view class="author_names">{{item.name}}</view>
						<view class="author_datetime">{{item.createtime}}</view>
					</view>
				</view>
				<view class="zuzhi_news_item_right">
					<image class="news_imgs" :src="photo_cdn+item.image_url" mode=""></image>
				</view>
			</view>
		</view>
		<empty v-else></empty>
		
	</view>
</template>

<script>
	import {getMySendByFamilyLog} from "@/utils/api/zuzhi.js";
	import config from "@/utils/config.js";
	let {uploadFile,photo_cdn} = config.baseUrl;
	
	export default {
		data() {
			return {
				photo_cdn,
				page:0,
				isshowall:false,
				ZuzhiLits:[],
			}
		},
		onLoad() {
			this.getMySendByFamilyLogfun();
		},
		onPullDownRefresh() {
			setTimeout(()=>{
				uni.stopPullDownRefresh(); //结束下拉刷新
			},3000)
		},
		onReachBottom() {
			if(!this.isshowall){
				this.getMySendByFamilyLogfun();
			}else{
				this.$api.msg('没有更多了~');
			}
		},
		methods: {
			todetaile(article_id){
				uni.navigateTo({
					url:`/pages/zupu/newsdetaile/newsdetaile?article_id=${article_id}`,
				})
			},
			getMySendByFamilyLogfun(){
				this.page++;
				let params = {
					page:this.page,
					action:"center",//查看自己发表的文章
				}
				
				getMySendByFamilyLog({
					...params,
				}).then((res)=>{
					if(res.code==1){
						this.ZuzhiLits = [...this.ZuzhiLits,...res.data.list];
						if(res.data.list.length==0){
							this.isshowall = true;
							if(this.page>1){
								this.$api.msg('没有更多了~');
							}
						}else{
							this.isshowall = true;
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	@import "./my_article.scss";
</style>
